<template>
	<div id="tmp1">
		<div class="mui-content" style="background-color:#fff">
		    
		    <ul class="mui-table-view mui-grid-view">
		        <li class="mui-table-view-cell mui-media mui-col-xs-6" v-for='item in list'>
		            <router-link v-bind="{to:'/goods/goodsinfo/'+item.id}">
		                <img class="mui-media-object" :src="item.img_url">
		                <div id="newsty" class="mui-media-body" v-text='item.title'></div>
		                <div id="desc">
		                	<p class="pirce">
		                	<span>${{item.sell_price}}</span>
		                		<del>￥{{item.market_price}}</del>
		                	</p>
		                	<p class="zt">
		                		<span>热卖中</span>
		                		<span>剩余{{item.stock_quantity}}件</span>
		                	</p>
		                </div>
	                </router-link>

                </li>
		    </ul>    
		</div>
	</div>
</template>

<script>
import { Toast } from 'mint-ui';
import common from '../../kits/common.js'
	export default{
		data(){
			return{
				list:[]
			}
		},
		created(){
			this.getgoodslist();
		},
		methods:{
			getgoodslist(){
				var url = common.apidomain + '/api/getgoods?pageindex=1' ;
				this.$http.get(url).then(function(res){
						var data = res.body;
						if(data.status != 0){
							Toast(data.message);
							return;
						}
						this.list = data.message;
				})
			}
		}
	}
</script>

<style scoped>
	.mui-content li{
		border:1px solid #999;
		margin-top:5px;
	}
	.mui-content li a{
		width:100%;
	}
	#newsty{
		color:#0094ff;
	}
	#desc{
		height: 100px;
		background-color:rgba(0,0,0,.1);
		text-align: left;
	}
	#desc .pirce span{
		color:red;
		margin-right:15px;
	}
	#desc .zt span:first-child{
		float: left;
	}
	#desc .zt span:nth-child(2){
		float: right;
	}
</style>